﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Tokenizer.Symbols.SymbolExtensions
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Collections.Generic;
using System.Linq;
using System.Web.Razor.Parser.SyntaxTree;
using System.Web.Razor.Text;

namespace System.Web.Razor.Tokenizer.Symbols
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the symbol extensions for the web tokenizer.</summary>
  public static class SymbolExtensions
  {
    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</summary>
    /// <returns>The content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</returns>
    /// <param name="span">The intersection with the given span.</param>
    public static LocationTagged<string> GetContent(this SpanBuilder span) => span.GetContent((Func<IEnumerable<ISymbol>, IEnumerable<ISymbol>>) (e => e));

    /// <summary>Gets the content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</summary>
    /// <returns>The content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</returns>
    /// <param name="span">The intersection with the given span.</param>
    /// <param name="filter">A list of chosen symbols.</param>
    public static LocationTagged<string> GetContent(
      this SpanBuilder span,
      Func<IEnumerable<ISymbol>, IEnumerable<ISymbol>> filter)
    {
      return filter((IEnumerable<ISymbol>) span.Symbols).GetContent(span.Start);
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</summary>
    /// <returns>The content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</returns>
    /// <param name="symbols">The symbols to provide.</param>
    /// <param name="spanStart">The starting index of the span.</param>
    public static LocationTagged<string> GetContent(
      this IEnumerable<ISymbol> symbols,
      SourceLocation spanStart)
    {
      return symbols.Any<ISymbol>() ? new LocationTagged<string>(string.Concat(symbols.Select<ISymbol, string>((Func<ISymbol, string>) (s => s.Content))), spanStart + symbols.First<ISymbol>().Start) : new LocationTagged<string>(string.Empty, spanStart);
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</summary>
    /// <returns>The content of this <see cref="T:System.Web.Razor.Tokenizer.Symbols.SymbolExtensions" /> class.</returns>
    /// <param name="symbol">The provided symbols.</param>
    public static LocationTagged<string> GetContent(this ISymbol symbol) => new LocationTagged<string>(symbol.Content, symbol.Start);
  }
}
